home *** CD-ROM | disk | FTP | other *** search
- /*
- * Copyright (C) 1994, Silicon Graphics, Inc.
- * All Rights Reserved.
- *
- * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
- * the contents of this file may not be disclosed to third parties, copied or
- * duplicated in any form, in whole or in part, without the prior written
- * permission of Silicon Graphics, Inc.
- *
- * RESTRICTED RIGHTS LEGEND:
- * Use, duplication or disclosure by the Government is subject to restrictions
- * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
- * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
- * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
- * rights reserved under the Copyright Laws of the United States.
- */
- /*_______________________________________________________________________
- |
- | blixfont.c - generates the font for the hishscore and the intro screen
- |
- | (C) 1994 Frans van Hoesel, Xtreme Graphics Software.
- */
-
- #include <gl/gl.h>
- #include <gl/device.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
-
- #include "blix.h"
- #include "blixfont.h"
- #include "haeberlifont.h"
-
- static long xwinsize, ywinsize;
- static float fsize = 0.1;
- static objfnt *fnt;
-
- void init_fonts(void) {
- char fullpath[512];
- FILE *f;
-
- strcpy(fullpath, datadir);
- strcat(fullpath, "Honesty.of");
- f = fopen(fullpath, "r");
- if (f == NULL) {
- strcpy(fullpath, "Honesty.of");
- f = fopen(fullpath, "r");
- if (f == NULL) {
- fprintf(stderr,"cannot open font file Honesty.of\n");
- gexit();
- exit(1);
- }
- }
- fnt = readobjfnt(fullpath);
- if(!fnt ) {
- fprintf(stderr,"meshfont: can't open font\n");
- exit(1);
- }
- }
-
- void set_fontsize(float size) {
-
- getsize(&xwinsize, &ywinsize);
- size = size * ywinsize;
- aafontsetsize(fnt, size);
- fsize = size;
- }
-
- void set_fontcolor(unsigned long c1, unsigned long c2) {
-
- charsetcolors(c1, c2);
- }
-
- void draw_stringXY(float x, float y, char *s) {
-
- int c;
- float xpos, ypos;
- x = x * xwinsize;
- y = y * ywinsize;
- aafontmoveto(x, y);
- if (s == NULL) return;
- while ( (c = *s++) != '\0' ) {
- get_charpos(&xpos, &ypos);
- drawaafntchar(fnt,c);
- if ( c == '\n') {
- aafontmoveto(x, ypos-fsize);
- }
- }
- }
-